package com.Maykk.Demo02;

/**
 * @ClassName: DemoTest
 * @Description: TODO Lambda
 * @Author: MaykkStar@163.com
 */
public class DemoTest {
    public static void main(String[] args) {
        // 实现类形式
        runEat(new MyEatableIml());

        // 匿名内部类形式
        runEat(new Eatable() {
            @Override
            public void eat(String food) {
                System.out.println("早上吃 " + food);
            }
        });

        // Lambda 形式
        runEat((String food) -> {
            System.out.println("晚上吃 " + food);
        });

        // 多态形式
        Eatable e = (String food) -> {
            System.out.println("夜宵还是吃 " + food);
        };
        e.eat("麻辣烫");
    }

    public static void runEat(Eatable e) {
        e.eat("麻辣烫");
    }
}
